package com.suning.sawp.service.impl.bi;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;

import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.suning.framework.dal.client.DalClient;
import com.suning.sawp.dto.bi.sale.StoreCateMonthSaleDataDto;
import com.suning.sawp.dto.bi.BiStoreYbMonthDto;
import com.suning.sawp.dto.bi.sale.StoreCateMonthSaleDto;
import com.suning.sawp.dto.bi.sale.StoreMaxSaleBrandMDto;
import com.suning.sawp.dto.mainpush.ClerkMainPushSaleComplete;
import com.suning.sawp.dto.mainpush.GuideRankShowDto;
import com.suning.sawp.dto.mainpush.RankingListDto;
import com.suning.sawp.dto.mainpush.StoreCateSaleStatis;
import com.suning.sawp.dto.mainpush.StoreMonSaleDetailDto;
import com.suning.sawp.dto.mainpush.TaskCommStatistic;
import com.suning.sawp.intf.bi.BiKafkaRealTimeSaleService;
import com.suning.sawp.intf.bi.BiSaleAmountDaoService;
import com.suning.sawp.po.bi.BIStaffPushTaskMonth;
import com.suning.sawp.po.bi.BIStaffSaleAllDay;
import com.suning.sawp.po.bi.BIStaffSaleAllMonth;
import com.suning.sawp.po.bi.BIStorePushTaskMonth;
import com.suning.sawp.po.bi.BIStoreSaleAllDay;
import com.suning.sawp.po.bi.BIStoreSaleAllMonth;
import com.suning.sawp.po.bi.BIStoreSaleCateDay;
import com.suning.sawp.po.bi.BIStoreSaleCateMonth;
import com.suning.sawp.po.bi.BiStoreCateBrandDay;
import com.suning.sawp.po.bi.BiStoreMonSaleTask;
import com.suning.sawp.po.mainpush.MainPushTask;
import com.suning.sawp.service.util.DateUtils;

@Service("biSaleAmountDaoService")
public class BiSaleAmountDaoServiceImpl implements BiSaleAmountDaoService {
    
    private static final Logger LOGGER = LoggerFactory.getLogger(BiSaleAmountDaoServiceImpl.class);

    @Resource
    DalClient dalClient;
    
    // dao层引用service层，不大合适，为老接口改动小计，暂时放这，后面数据模块拆出后，需要重构
    @Resource
    BiKafkaRealTimeSaleService biKafkaRealTimeSaleService;
    
    
    @Override
    public BIStoreSaleAllMonth queryStoreSaleAllMonthByStoreCode(String storeCode, String saleMonth) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("saleMonth", saleMonth);
        
        return dalClient.queryForObject("BI_STORE_SALE_ALL_MONTH.QUERY_STORE_SALE", 
                paramMap, BIStoreSaleAllMonth.class);
    }

    @Override
    public BIStoreSaleAllDay queryStoreSaleAllDayByStoreCode(String storeCode, String saleDate) {
        // 如果查询日期为当日，则查询mongodb接收到的kafka实时数据
        String today = DateUtils.getDateStrByFormat(new Date(), DateUtils.YYYYMMDD_PATTERN);
        if (today.equals(saleDate)) {
            BigDecimal saleAmount = biKafkaRealTimeSaleService.queryStoreDaySale(storeCode);
            BIStoreSaleAllDay allDay = new BIStoreSaleAllDay();
            allDay.setSaleAmount(saleAmount);
            return allDay;
        }
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("saleDate", saleDate);
        
        return dalClient.queryForObject("BI_STORE_SALE_ALL_DAY.QUERY_STORE_SALE", 
                paramMap, BIStoreSaleAllDay.class);
    }

    @Override
    public List<BIStorePushTaskMonth> queryStorePushItemsByStoreCode(String storeCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        
        return dalClient.queryForList("BI_STORE_PUSH_ITEM_MONTH.QUERY_STORE_MIAN_PUSH", paramMap, BIStorePushTaskMonth.class);
    }

    @Override
    public List<TaskCommStatistic> queryTaskCommNoAssigns(Set<Long> taskNos) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("taskNos", taskNos);
        paramMap.put("taskStatus", MainPushTask.AssignStatusConstants.ASSIGNED);
        Set<String> delCommStatus = new HashSet<String>();
        delCommStatus.add(MainPushTask.CommodityStatusConstants.DEL_NO_READ);
        delCommStatus.add(MainPushTask.CommodityStatusConstants.DEL_READ);
        paramMap.put("delCommStatus", delCommStatus);
        
        return dalClient.queryForList("STORE_MAIN_PUSH.QUERY_NO_ASSIGN_COMM_COUNT", paramMap, TaskCommStatistic.class);
    }

    @Override
    public List<BIStoreSaleCateMonth> queryStoreCateSaleAmountMonth(String storeCode, Set<String> categoryCodes, String saleMonth) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("categoryCodes", categoryCodes);
        paramMap.put("saleMonth", saleMonth);
        List<BIStoreSaleCateMonth> saleAmounts = dalClient
                .queryForList("BI_STORE_SALE_CATE_MONTH.QUERY_STORE_CATE_SALE_AMOUNT", paramMap, BIStoreSaleCateMonth.class);
        return saleAmounts;
    }

    @Override
    public List<BIStoreSaleCateDay> queryStoreCateSaleAmountDay(String storeCode, Set<String> categoryCodes, String saleDate) {
        // 如果查询日期为当日，则查询mongodb接收到的kafka实时数据
        String today = DateUtils.getDateStrByFormat(new Date(), DateUtils.YYYYMMDD_PATTERN);
        if (today.equals(saleDate)) {
            List<BIStoreSaleCateDay> cateDays = new ArrayList<BIStoreSaleCateDay>();
            if (CollectionUtils.isNotEmpty(categoryCodes)) {
                for (String cateCode : categoryCodes) {
                    BigDecimal saleAmount = biKafkaRealTimeSaleService.queryStoreCateDaySale(storeCode, cateCode);
                    Integer saleVolume = biKafkaRealTimeSaleService.queryStoreCateDaySaleVolume(storeCode, cateCode);
                    BIStoreSaleCateDay allDay = new BIStoreSaleCateDay();
                    allDay.setSaleAmount(saleAmount);
                    allDay.setCateCode(cateCode);
                    // 销售数量
                    allDay.setSaleVolume(saleVolume);
                    cateDays.add(allDay);
                }
            }
            
            return cateDays;
        }
        
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("categoryCodes", categoryCodes);
        paramMap.put("saleDate", saleDate);
        List<BIStoreSaleCateDay> saleAmounts = dalClient.queryForList("BI_STORE_SALE_CATE_DAY.QUERY_STORE_CATE_SALE_AMOUNT", paramMap, BIStoreSaleCateDay.class);
        return saleAmounts;
    }

    @Override
    public BIStaffSaleAllMonth queryStaffSaleAllMonthByStaffId(String staffId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("staffId", staffId);
        paramMap.put("saleMonth", DateUtils.getThisMonth());
        return dalClient.queryForObject("BI_STAFF_SALE_ALL_MONTH.QUERY_STAFF_SALE", 
                paramMap, BIStaffSaleAllMonth.class);
    }

    @Override
    public BIStaffSaleAllDay queryStaffSaleAllDayByStaffId(String staffId) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("staffId", staffId);
        paramMap.put("saleDate", DateUtils.getDateStrByFormat(new Date(), DateUtils.YYYYMMDD_PATTERN));
        return dalClient.queryForObject("BI_STAFF_SALE_ALL_DAY.QUERY_STAFF_SALE", 
                paramMap, BIStaffSaleAllDay.class);
        // 此处查询个人当日销售，改为查询kafka实时销售数据
        /*BIStaffSaleAllDay allDay = new BIStaffSaleAllDay();
        BigDecimal saleAmount = biKafkaRealTimeSaleService.queryStaffDaySale(staffId);
        allDay.setStaffId(staffId);
        allDay.setSaleAmount(saleAmount);
        return allDay;*/
    }

    @Override
    public List<BIStoreSaleAllMonth> querySaleSortStoreByRegCd(String regionCode, int limit) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("disCode", regionCode);
        paramMap.put("saleMonth", DateUtils.getThisMonth());
        paramMap.put("limit", limit);
        
        return dalClient.queryForList("BI_STORE_SALE_ALL_MONTH.QUERY_STORE_SALE_SORT", 
                paramMap, BIStoreSaleAllMonth.class);
    }

    @Override
    public List<GuideRankShowDto> querySaleCateSortStoreByRegcd(String regionCode, String categoryCode, int limit) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("disCode", regionCode);
        paramMap.put("categoryCode", categoryCode);
        paramMap.put("saleMonth", DateUtils.getThisMonth());
        paramMap.put("limit", limit);
        return dalClient.queryForList("BI_STORE_SALE_CATE_MONTH.QUERY_STORE_CATE_SALE_RANK", 
                paramMap, GuideRankShowDto.class);
    }

    @Override
    public List<BIStaffSaleAllMonth> queryStaffSaleByStoreCode(String storeCode, int limit) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("saleMonth", DateUtils.getThisMonth());
        paramMap.put("limit", limit);
        return dalClient.queryForList("BI_STAFF_SALE_ALL_MONTH.QUERY_STORE_CLERK_SALE_RANK", 
                paramMap, BIStaffSaleAllMonth.class);
    }

    @Override
    public List<StoreCateSaleStatis> queryStoreCateSaleStatis(String categoryCode,
            String storeCode, int sort) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("saleMonth", DateUtils.getThisMonth());
        paramMap.put("saleDate", DateUtils.getDateStrByFormat(new Date(), DateUtils.YYYYMMDD_PATTERN));
        paramMap.put("categoryCode", categoryCode);
        paramMap.put("sort", sort);
        return dalClient.queryForList("BI_STORE_SALE_CATE_MONTH.QUERY_STORE_CATE_SALE_DETAIL"
                , paramMap, StoreCateSaleStatis.class);
    }

    @Override
    public List<StoreCateSaleStatis> queryStoreCateDaySale(String categoryCode,
            String storeCode, int startIndex, int limit, int sort, String sortType) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("categoryCode", categoryCode);
        // 月初日期
        Date thisMonStartDate = DateUtils.getFirstDayZeroPointOfMonth(0);
        String thisMonStartDateStr = DateUtils.getDateStrByFormat(thisMonStartDate, DateUtils.YYYYMMDD_PATTERN);
        paramMap.put("thisMonStartDate", thisMonStartDateStr);
        paramMap.put("startIndex", startIndex);
        paramMap.put("limit", limit);
        paramMap.put("sort", sort);
        paramMap.put("sortType", sortType);
        List<StoreCateSaleStatis> list = dalClient.queryForList("BI_STORE_SALE_CATE_DAY.QUERY_STORE_CATE_DATE_SALE_DETAIL"
                , paramMap, StoreCateSaleStatis.class);
        return list;
        // 今日销售数据取至kafka实时数据
        /*BigDecimal saleAmount = biKafkaRealTimeSaleService.queryStoreCateDaySale(storeCode, categoryCode);
        StoreCateSaleStatis todayStatis = new StoreCateSaleStatis();
        todayStatis.setCategoryCode(categoryCode);
        todayStatis.setSaleAmount(saleAmount);
        
        List<StoreCateSaleStatis> result = new ArrayList<StoreCateSaleStatis>();
        if ("1".equals(sortType)) {
            // 按日期排序
            if (-1 == sort) {
                // 倒序
                result.add(todayStatis);
                result.addAll(list);
            } else if (1 == sort) {
                // 正序
                list.add(todayStatis);
                result.addAll(list);
            }
        } else if ("2".equals(sortType)) {
            // 按销售额排序
            for (StoreCateSaleStatis statis : list) {
                if (-1 == sort) {
                    // 倒序
                    if (statis.getSaleAmount().compareTo(todayStatis.getSaleAmount()) < 0) {
                        result.add(todayStatis);
                    }
                    
                } else if (1 == sort) {
                    // 正序
                    if (statis.getSaleAmount().compareTo(todayStatis.getSaleAmount()) > 0) {
                        result.add(todayStatis);
                    }
                }
                result.add(statis);
            }
        }
        
        return result;*/
    }

    @Override
    public List<RankingListDto> queryStoreMainPushRankingList(String regionCode, Long hqTaskNo) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("taskNo", hqTaskNo);
        paramMap.put("regionCode", regionCode);
        paramMap.put("limit", 10);
        return dalClient.queryForList("BI_STORE_PUSH_TASK_MONTH.QUERY_STORE_CATE_PUSH_RANK"
                , paramMap, RankingListDto.class);
    }

    @Override
    public List<GuideRankShowDto> queryStoreGuideMainPushRankingList(String regionCode, Long hqTaskNo) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("taskNo", hqTaskNo);
        paramMap.put("regionCode", regionCode);
        paramMap.put("limit", 10);
        return dalClient.queryForList("BI_STORE_PUSH_TASK_MONTH.QUERY_STORE_CATE_PUSH_RANK_GUIDE"
                , paramMap, GuideRankShowDto.class);
    }

    @Override
    public List<BIStaffPushTaskMonth> queryStoreStaffMainPushRankingList(String storeCode, Long hqTaskNo) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("taskNo", hqTaskNo);
        paramMap.put("limit", 10);
        return dalClient.queryForList("BI_STAFF_PUSH_TASK_MONTH.QUERY_STORE_CATE_STAFF_RANK"
                , paramMap, BIStaffPushTaskMonth.class);
    }

    @Override
    public List<ClerkMainPushSaleComplete> queryClerkMainPushSaleCompletes(Long hqTaskNo, String storeCode,  String startDate,
            String endDate, String goodsUniCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("hqTaskNo", hqTaskNo);
        paramMap.put("startDate", startDate);
        paramMap.put("endDate", endDate);
        paramMap.put("storeCode", storeCode);
        paramMap.put("goodsUniCode", goodsUniCode);
        
        return dalClient.queryForList("BI_STAFF_SALE_ALL_DAY.QUERY_CLERK_MAIN_PUSH_SALE_PERIOD", paramMap, ClerkMainPushSaleComplete.class);
    }

    @Override
    public List<ClerkMainPushSaleComplete> queryClerkMainPushSaleDayCompletes(Long hqTaskNo, String storeCode,
            String saleDate, String goodsUniCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("hqTaskNo", hqTaskNo);
        paramMap.put("saleDate", saleDate);
        paramMap.put("storeCode", storeCode);
        paramMap.put("goodsUniCode", goodsUniCode);
        
        return dalClient.queryForList("BI_STAFF_SALE_ALL_DAY.QUERY_CLERK_MAIN_PUSH_SALE_DAY", paramMap, ClerkMainPushSaleComplete.class);
    }

    @Override
    public List<StoreMonSaleDetailDto> queryStoreMonSaleDetails(String storeCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        return dalClient.queryForList("BI_STORE_MON_SALE_TASK.QUERY_STORE_MON_SALE_TASK", paramMap, StoreMonSaleDetailDto.class);
    }

    @Override
    public String queryLatestSaleMonth(String storeCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        
        return dalClient.queryForObject("BI_STORE_MON_SALE_TASK.QUERY_LASTEST_SALE_MON", paramMap, String.class);
    }

    @Override
    public List<BiStoreMonSaleTask> queryLastMonStoreRealSale(String lastMonth, int startIndex, int limit) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("lastMonth", lastMonth);
        paramMap.put("startIndex", startIndex);
        paramMap.put("limit", limit);
        
        return dalClient.queryForList("BI_STORE_MON_SALE_TASK.QUERY_LAST_MON_REAL_SALES", paramMap, BiStoreMonSaleTask.class);
    }

    @Override
    public StoreCateMonthSaleDto queryStoreCateMonthSale(String month, String cateCode, String storeCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("saleMonth", month);
        paramMap.put("cateCode", cateCode);
        paramMap.put("storeCode", storeCode);
        StoreCateMonthSaleDto saleDto = dalClient.queryForObject("BI_STORE_GUIDE.QUERY_STORE_CATE_MONTH_SALE", paramMap, StoreCateMonthSaleDto.class);
        
        StoreCateMonthSaleDto saleDtoTask = dalClient.queryForObject("BI_STORE_GUIDE.QUERY_STORE_CATE_MONTH_SALE_TASK", paramMap, StoreCateMonthSaleDto.class);
        StoreCateMonthSaleDto dto = new StoreCateMonthSaleDto();
        if (null != saleDto) {
            dto.setCustAvgPrice(saleDto.getCustAvgPrice());
            dto.setCustNum(saleDto.getCustNum());
            dto.setLastYearCustNum(saleDto.getLastYearCustNum());
            dto.setLastYearCustAvgPrice(saleDto.getLastYearCustAvgPrice());
            dto.setLastYearCustAvgPrice(saleDto.getLastYearCustAvgPrice());
            dto.setLastYearSaleAmount(saleDto.getLastYearSaleAmount());
            dto.setSaleAmount(saleDto.getSaleAmount());
            dto.setSaleMonth(saleDto.getSaleMonth());
        }
        if (null != saleDtoTask) {
            dto.setTaskGrossProfit(saleDtoTask.getTaskGrossProfit());
            dto.setTaskSaleAmount(saleDtoTask.getTaskSaleAmount());
        }
        return dto;
    }
    
    @Override
    public StoreCateMonthSaleDataDto queryStoreCateMonthSaleData(String month, String cateCode, String storeCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("saleMonth", month);
        paramMap.put("cateCode", cateCode);
        paramMap.put("storeCode", storeCode);
        StoreCateMonthSaleDataDto saleDto = dalClient.queryForObject("BI_STORE_GUIDE.QUERY_STORE_CATE_MONTH_SALE_DATA", paramMap, StoreCateMonthSaleDataDto.class);
        
        StoreCateMonthSaleDto saleDtoTask = dalClient.queryForObject("BI_STORE_GUIDE.QUERY_STORE_CATE_MONTH_SALE_TASK", paramMap, StoreCateMonthSaleDto.class);
        StoreCateMonthSaleDataDto dto = new StoreCateMonthSaleDataDto();
        if (null != saleDto) {
            dto.setCustAvgPrice(saleDto.getCustAvgPrice());
            dto.setCustNum(saleDto.getCustNum());
            dto.setLastYearCustNum(saleDto.getLastYearCustNum());
            dto.setLastYearCustAvgPrice(saleDto.getLastYearCustAvgPrice());
            dto.setLastYearCustAvgPrice(saleDto.getLastYearCustAvgPrice());
            dto.setLastYearSaleAmount(saleDto.getLastYearSaleAmount());
            dto.setSaleAmount(saleDto.getSaleAmount());
            dto.setSaleMonth(saleDto.getSaleMonth());
            dto.setSaleVolume(saleDto.getSaleVolume());
            dto.setLastYearSaleVolume(saleDto.getLastYearSaleVolume());
        }
        if (null != saleDtoTask) {
            dto.setTaskGrossProfit(saleDtoTask.getTaskGrossProfit());
            dto.setTaskSaleAmount(saleDtoTask.getTaskSaleAmount());
        }
        return dto;
    }

    @Override
    public BiStoreCateBrandDay queryMaxStoreCateBrandDay(String saleDate, String storeCode, String cateCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("saleDate", saleDate);
        paramMap.put("storeCode", storeCode);
        paramMap.put("cateCode", cateCode);
        return dalClient.queryForObject("BI_STORE_GUIDE.QUERY_STORE_CATE_MAX_BRAND_D", paramMap, BiStoreCateBrandDay.class);
    }

    @Override
    public StoreMaxSaleBrandMDto queryMaxStoreCateBrandMonth(String saleMonth, String lastYearSaleMonth, 
            String storeCode, String cateCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("saleMonth", saleMonth);
        paramMap.put("storeCode", storeCode);
        paramMap.put("cateCode", cateCode);
        paramMap.put("lastYearSaleMonth", lastYearSaleMonth);
        StoreMaxSaleBrandMDto thisYearBrand = dalClient.queryForObject("BI_STORE_GUIDE.QUERY_STORE_CATE_MAX_BRAND_M", paramMap, StoreMaxSaleBrandMDto.class);
        StoreMaxSaleBrandMDto lastYearBrand = dalClient.queryForObject("BI_STORE_GUIDE.QUERY_STORE_CATE_MAX_BRAND_LAST_YEAR_M", paramMap, StoreMaxSaleBrandMDto.class);
        StoreMaxSaleBrandMDto dto = new StoreMaxSaleBrandMDto();
        if (null != thisYearBrand) {
            dto.setBrandCode(thisYearBrand.getBrandCode());
            dto.setBrandName(thisYearBrand.getBrandName());
            dto.setSaleAmount(thisYearBrand.getSaleAmount());
        }
        if (null != lastYearBrand) {
            dto.setLastYearBrandCode(lastYearBrand.getLastYearBrandCode());
            dto.setLastYearBrandName(lastYearBrand.getLastYearBrandName());
            dto.setLastYearSaleAmount(lastYearBrand.getLastYearSaleAmount());
        }
        return dto;
    }

    @Override
    public List<StoreCateMonthSaleDto> queryStoreCateSalesInYear(String year, String storeCode, String cateCode) {
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("storeCode", storeCode);
        paramMap.put("cateCode", cateCode);
        String minMonth = year + "01";
        String maxMonth = year + "12";
        paramMap.put("minMonth", minMonth);
        paramMap.put("maxMonth", maxMonth);
        return dalClient.queryForList("BI_STORE_GUIDE.QUERY_STORE_CATE_SALE_IN_YEAR", paramMap, StoreCateMonthSaleDto.class);
    }

    @Override
    public BiStoreYbMonthDto queryStoreYbSaleByCate(String month, String storeCode, String cateCode) {
        Map<String, Object> ybParamMap = new HashMap<String, Object>();
        ybParamMap.put("month", month);
        ybParamMap.put("storeCode",storeCode);
        ybParamMap.put("cateCode",cateCode);
        BiStoreYbMonthDto ybMonthSale = null;
        try {
            ybMonthSale = dalClient.queryForObject("BI_STORE_YB.QUERY_CATE_YB_MONTH", ybParamMap,
                    BiStoreYbMonthDto.class);
        } catch (Exception e) {
            LOGGER.error("queryStoreYbSaleByCate ,month:"+month+",storeCode:"+storeCode+",cateCode:"+cateCode,e);
        }
        return ybMonthSale;
    }
    
}
